package com.company;

//泛型类的定义
class Box<T> {
    private T content;

    public T getContent() {
        return content;
    }

    public void setContent(T content) {
        this.content = content;
    }
}

public class TDemo {
    public static void main(String[] args) {
        //使用
        Box<String> box = new Box<String>();
        box.setContent("hello!");
        String content = box.getContent();
        System.out.println(content);

        Box<Integer> box1 = new Box<>();
        box1.setContent(45);
        Integer content1 = box1.getContent();
        System.out.println(content1);


        Box<StudentScore> box3 = new Box<>();
        box3.setContent(new StudentScore("001", "TOM1", "男", 78, 87, 98));
        StudentScore content2 = box3.getContent();
        System.out.println(content2);
    }
}